package Items
{
	import EventDispatchers.ImageLoader;
	import EventDispatchers.XMLLoader;
	
	import Events.ImageEvent;
	import Events.XMLEvent;
	
	import Graphics.*;
	
	import Utils.Camera;
	
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.geom.Rectangle;
	
	public class Item extends GameSprite
	{
		protected var name:String;
		public var isPickedup:Boolean = false;
		protected var uses:int = -1;
		
		public function get Name():String {return name;}
		public function get IsActive():Boolean 
		{ 
			if(this.uses > 0 || this.uses == -1)
			{
				return true;
			}
			return false;
		}
		
		public function Item(game:Level)
		{
			super(game);
		}
		
		public override function Initialize():void
		{
			super.Initialize();
		}
		
		public override function Update(deltaTime:int):void
		{
			super.Update(deltaTime);
		}
		
		public override function Draw(camera:Camera, canvas:BitmapData):BitmapData
		{
			this.position.x = this.worldPosition.x - camera.X;
			this.position.y = this.worldPosition.y - camera.Y;
			if(currentAnimation != null && !isPickedup)
			{
				canvas.copyPixels(currentAnimation.Graphic.bitmapData, blitRectangle, position);
			}
			return canvas;
		}
		
		public function Activate():void
		{
			
		}
		
		public function Deactivate():void
		{
			
		}
		
	}

}